package com.juc.forkJoinPool.forkJoinPool7;

import java.beans.FeatureDescriptor;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;

public class Run3 {
	// public <T> ForkJoinTask<T> submit(Runnable task, T result)
	//建议第三种future.get()
	public static void main(String[] args) throws InterruptedException, ExecutionException {
		Userinfo userinfo = new Userinfo();
		MyRunnable runnable = new MyRunnable(userinfo);
		ForkJoinPool pool = new ForkJoinPool();
		Future<Userinfo> future = pool.submit(runnable,userinfo);
		//建议使用此种方式future.get()
		//因为get()方法呈阻塞效果
		System.out.println(future);
		System.out.println("userinfo username " + future.get().getUsername());
	}
}
